package com.aabte.auth.account.resource.api.auth;

import com.aabte.commons.bean.BaseResponse;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.validation.Valid;

@RequestMapping(path = "/v1/auth")
public interface AuthApi {

    @RequestMapping(path = "/token", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE,
            produces = MediaType.APPLICATION_JSON_VALUE)
    BaseResponse<String> token(@RequestBody @Valid AuthCommand command);

    @RequestMapping(path = "/me", method = RequestMethod.GET)
    BaseResponse<AuthAccountDTO> me(@RequestHeader(name = "Authorization") String token);

}
